Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pending ack handling for buffer overflow drops #81

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

zmstone
Copy link
Contributor

@zmstone zmstone commented Oct 9, 2024

introduced in 4.0.0 (the pending-ack compaction feature), when there are a few requests sent inflight, AND the replayq buffer overflows, the overflown calls to be dropped are in the middle of the compacted call-id range, hence caused below assertion failure:

{cause => unexpected_id,max => 1728471879846415,min => 1728471879846415,got => 1728471879846430},[{wolff_pendack,take2,4,[{file,"wolff_pendack.erl"},{line,122}]},{wolff_pendack,take,2,[{f
ile,"wolff_pendack.erl"},{line,92}]},{wolff_producer,evaluate_pending_ack_funs,3,[{file,"wolff_producer.erl"},{line,755}]},{wolff_producer,handle_overflow,2,[{file,"wolff_producer.erl"},{line,957}]}

The fix is to keep two queues for pending acks instead, one for the backlog (replayq buffer), another for inflight.

a bug introduced in 4.0.0: when replayq overflow has to drop
calls while there are inflight requests, the producer may crash
on the defensive assertion.
test/wolff_tests.erl Outdated Show resolved Hide resolved
src/wolff_pendack.erl Outdated Show resolved Hide resolved
src/wolff_pendack.erl Outdated Show resolved Hide resolved
@zmstone zmstone merged commit a7e5b04 into kafka4beam:main Oct 9, 2024
6 checks passed
@zmstone zmstone deleted the fix-pending-ack-handling branch October 9, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants